% ActionFun
function [W_aj, C, K_L, x, idx, ph, params] = ActionFun(params)

% generating: t, t_miu, f_y, intervals of sampling
params = time_sampling(params);
[C, Z] = inter_mode(params);

% computing the temporal spectrum
if params.multilayer == 0 %homogeneous case
    W_aj = temporal_spectrum(params,Z);
else
    % multi-layer cases
    [W_aj,params] = temporal_multilayer(params,Z);
end

% 计算相对于x轴theta角的风速的psd
if params.RotateAgl ~= 0
    W_aj = W_aj_theta(W_aj, params.RotateAgl, params.n_max);
end

% Constructing K-L function
[ph,x,ZM,C,V,idx] = zernike_PS(params,C);
% V: decomposed matrix
% C: Covariance Matrix
K_L = Zernike_to_K_L(V, ZM);

% end of the function
end